home *** CD-ROM | disk | FTP | other *** search
- Path: colossus.holonet.net!russell
- From: russell@news.mdli.com (Russell Blackadar)
- Newsgroups: comp.lang.c++
- Subject: Re: More ?'s re: copy ctor
- Date: 13 Feb 1996 02:41:18 GMT
- Organization: HoloNet National Internet Access System: 510-704-1058/modem
- Message-ID: <4fotoe$nqe@colossus.holonet.net>
- References: <DMD0Kq.LHx@Virginia.EDU> <DMn8B8.yJ@Virginia.EDU>
- NNTP-Posting-Host: jubal.mdli.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Gregory Carl Lewin (gcl8a@Virginia.EDU) wrote:
- [...first part deleted... see my reply in other thread...]
-
- : ... However, if foo
- : is a member function of one of the classes, the error is not
- : given:
-
- : Base2::foo(Base2* b) {...}
- : Derived::foo(Derived* d) {Base2::foo(d); ...} //OK!
-
- Quoting from the ARM, p. 36, "The standard conversion of a
- derived class pointer to one of its bases can be done only
- by a function that can access that class. If the base is
- private, the function needs to be a friend or a member of
- a class that has the base as an immediate base class."
-
- In other words, conversion from Derived12* to Base2* is
- automatic within a Base2 member function, which explains
- why you got no error message.
-
- By the way, since your question is about pointers, it has
- nothing whatever to do with copy ctors!
- --
- Russell Blackadar, russell@mdli.com
-